package com.im.service.jim.processor;

import com.im.service.service.ImChatService;
import lombok.extern.slf4j.Slf4j;
import org.jim.core.ImChannelContext;
import org.jim.core.packets.ChatBody;
import org.jim.server.config.ImServerConfig;
import org.jim.server.processor.chat.BaseAsyncChatMessageProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author liuzhiqiang
 */
@Slf4j
@Component
public class CustomMessageProcessor extends BaseAsyncChatMessageProcessor {

    @Autowired
    private ImChatService chatService;

    public void setImServerConfig(ImServerConfig imServerConfig) {
        super.imServerConfig = imServerConfig;
    }

    /**
     * @param chatBody
     * @param imChannelContext
     */
    @Override
    protected void doProcess(ChatBody chatBody, ImChannelContext imChannelContext) {
        chatService.chatProcessing(chatBody, imChannelContext);
    }
}
